<!DOCTYPE html>
<html>
<head>
    <?php include(__DIR__ . '/../Public/header.php'); ?>
    <style type="text/css"></style>
</head>
<body class="skin-black fixed">
<?php include(__DIR__ . '/../Public/nav.php'); ?>
<div class="wrapper row-offcanvas row-offcanvas-left">
    <?php include(__DIR__ . '/../Public/left.php'); ?>
    <aside class="right-side">
        <!-- Main content -->
        <section class="content">
            <div class="row">
                <div class="col-md-12">
                    <!--breadcrumbs start -->
                    <ul class="breadcrumb">
                        <li><a href="#"><i class="fa fa-home"></i> <?=L('ucenter',1)?></a></li>
                    </ul>
                    <!--breadcrumbs end -->
                </div>
            </div>
            <div class="row" style="margin-bottom:5px;">
                <div class="col-md-3">
                    <div class="sm-st clearfix" style="position:relative;">
                        <span class="sm-st-icon st-green"><i class="fa fa-jpy"></i></span>
                        <div class="sm-st-info">
                            <span><?=$member['rmb']?></span>
                            <?=L('use',2)?>
                        </div>
                        <!-- <a href="#outRmb" data-toggle="modal" class="fa fa-minus-circle" style="position:absolute;top:20px;right:20px;"></a> -->
                    </div>
                </div>
                <div class="col-md-3">
                    <div class="sm-st clearfix">
                        <span class="sm-st-icon st-red"><i class="fa fa-jpy"></i></span>
                        <div class="sm-st-info">
                            <span><?=$member['forzen_rmb']?></span>
                            <?=L('lock',2)?>
                        </div>
                    </div>
                </div>
                <div class="col-md-3">
                    <div class="sm-st clearfix" style="position:relative;">
                        <span class="sm-st-icon st-violet"><i class="fa fa-credit-card"></i></span>
                        <div class="sm-st-info">
                            <span><?=$cardNum?$cardNum:0?></span>
                            <?=L('bank_id',2)?>
                        </div>
                        <a href="#addCard" data-toggle="modal" class="btn btn-xs btn-success fa fa-plus" style="position:absolute;top:20px;right:20px;"></a>
                    </div>
                </div>
                <div class="col-md-3">
                    <div class="sm-st clearfix" style="position:relative;">
                        <span class="sm-st-icon st-blue"><i class="fa fa-check-square-o"></i></span>
                        <div class="sm-st-info">
                            <span><?=$member['auth']?L("yes"):L("no")?></span>
                            <?=L('google_auth',2)?> <a href="https://itunes.apple.com/cn/app/google-authenticator/id388497605?mt=8" target="_blank">ios</a>，<a href="https://play.google.com/store/apps/details?id=com.google.android.apps.authenticator2" target="_blank">android</a>
                        </div>
                        <a href="javascript:;" id='addAuthBtn'  class="btn btn-xs btn-success fa fa-cog" style="position:absolute;top:20px;right:20px;"></a>
                    </div>
                </div>
            </div>
            
            <div class="row">
                <div class="col-md-12">
                    <div class="panel">
                        <header class="panel-heading"><?=L('my_coin',1)?> <span class="pull-right"><input type="checkbox" <?php if($member['hidden_empty_currency']>0){echo 'checked';}?> data-url='<?=url('set_show_empty_currency')?>' class="flat-grey hidden-currency"/><?=L('hidden_empty_currency')?></span></header>
                        <div class="panel-body" style="height:240px;overflow:auto;" id='myCurrencyList' data-url="<?=url('ucenter/get_currency')?>">
                        </div>
                    </div>
                </div>
                <div class="col-md-6">
                    <div class="panel">
                        <header class="panel-heading"><?=L('my_pay',1)?></header>
                        <div class="panel-body" style="height:400px;">
                            <div class="box-tools m-b-15">
                                <div class="input-group">
                                    <div class="pull-right">
                                        <select class="form-control input-sm pull-left currency_id" style="width: 150px;display:inline-block;margin-right:-1px">
                                            <option value=""><?=L('all',1)?></option>
                                            <option value="0">CNY</option>
                                            <?php foreach($currency as $key=>$value){ ?>
                                            <option value="<?=$value['currency_id']?>"><?=$value['currency_mark']?></option>
                                            <?php } ?>
                                        </select>
                                    </div>
                                    <div class="input-group-btn">
                                        <button class="btn btn-sm btn-default"  id='myInSearchBtn'><i class="fa fa-search"></i></button>
                                    </div>
                                </div>
                            </div>
                            <div id='myInList'  data-url="<?=url('ucenter/get_pay')?>"></div>
                        </div>
                    </div>
                </div>
                <div class="col-md-6">
                    <div class="panel">
                        <header class="panel-heading"><?=L('my_withdraw',1)?></header>
                        <div class="panel-body" style="height:400px;">
                            <div class="box-tools m-b-15">
                                <div class="input-group">
                                    <div class="pull-right">
                                        <select class="form-control input-sm pull-left currency_id" style="width: 150px;display:inline-block;margin-right:-1px">
                                            <option value=""><?=L('all',1)?></option>
                                            <option value="0">CNY</option>
                                            <?php foreach($currency as $key=>$value){ ?>
                                            <option value="<?=$value['currency_id']?>"><?=$value['currency_mark']?></option>
                                            <?php } ?>
                                        </select>
                                    </div>
                                    <div class="input-group-btn">
                                        <button class="btn btn-sm btn-default"  id='myOutSearchBtn'><i class="fa fa-search"></i></button>
                                    </div>
                                </div>
                            </div>
                            <div  id='myOutList' data-url="<?=url('ucenter/get_withdraw')?>"></div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="panel">
                <header class="panel-heading"><?=L('my_order',1)?></header>
                <div class="panel-body">
                    <div class="box-tools m-b-15">
                        <div class="input-group">
                            <div class="pull-right">
                                <select class="form-control input-sm pull-left currency_id" style="width: 150px;display:inline-block;margin-right:-1px">
                                    <option value=""><?=L('all',1)?></option>
                                    <?php foreach($currency as $key=>$value){ ?>
                                    <option value="<?=$value['currency_id']?>"><?=$value['currency_mark']?></option>
                                    <?php } ?>
                                </select>
                            </div>
                            <div class="input-group-btn">
                                <button class="btn btn-sm btn-default" id='myOrderSearchBtn'><i class="fa fa-search"></i></button>
                            </div>
                        </div>
                    </div>
                    <div id='myOrderList' class="table_list"  data-url="<?=url('ucenter/get_order')?>">
                    </div>
                </div>
            </div>
            <div class="panel">
                <header class="panel-heading"><?=L('my_trade',1)?></header>
                <div class="panel-body">
                    <div class="box-tools m-b-15">
                        <div class="input-group">
                            <div class="pull-right">
                                <select class="form-control input-sm pull-left currency_id" style="width: 150px;display:inline-block;margin-right:-1px">
                                    <option value=""><?=L('all',1)?></option>
                                    <?php foreach($currency as $key=>$value){ ?>
                                    <option value="<?=$value['currency_id']?>"><?=$value['currency_mark']?></option>
                                    <?php } ?>
                                </select>
                            </div>
                            <div class="input-group-btn">
                                <button class="btn btn-sm btn-default"  id='myTradeSearchBtn'><i class="fa fa-search"></i></button>
                            </div>
                        </div>
                    </div>
                    <div id='myTradeList' class="table_list" data-url="<?=url('ucenter/get_trade')?>">
                    </div>
                </div>
            </div>
        <!-- row end -->
        </section><!-- /.content -->

        <?php include(__DIR__ . '/../Public/copyright.php'); ?>
    </aside><!-- /.right-side -->
</div><!-- ./wrapper -->
<!-- google认证 -->
<div aria-hidden="true" role="dialog" tabindex="-1" id="addAuth" class="modal fade">
    <div class="modal-dialog " >
        <div class="modal-content">
            <div class="modal-header">
                <button aria-hidden="true" data-dismiss="modal" class="close" type="button">×</button>
                <h4 class="modal-title"><?=L('google_auth',2)?></h4>
            </div>
            <div class="modal-body">
                <div class="row m-b-15">
                    <div style="padding:0 20px;">
                        <p>请在手机上安装并打开Google Authenticator,扫描二维码或手动输入密钥,将APP中生产的动态验证码填写至如下输入框</p>
                        <p><a href="https://itunes.apple.com/cn/app/google-authenticator/id388497605?mt=8" target="_blank">ios</a>，<a href="https://play.google.com/store/apps/details?id=com.google.android.apps.authenticator2" target="_blank">android</a></p>
                    </div>
                    
                </div>
                <div class="row">
                    <div class="col-md-6">
                        <img src="<?=url('get_auth_qrcode?sk='.$secret)?>" class="img-responsive center-block" >
                        <div style="padding:0 20px;">
                            <p>密钥：<?=$secret?></p>
                        </div>
                    </div>
                    <div class="col-md-6">
                        <form class="google-auth-form" data-action='<?=url('ucenter/auth')?>' role="form" onsubmit="return false;">
                            <div class="form-group">
                                <label for="codeInput" class="control-label"><?=L('code',2)?></label>
                                <input type="hidden" class="form-control" id='skInput' name='info[sk]' value='<?=$secret?>'>
                                <input type="text" class="form-control" name='info[code]' id="codeInput" data-rule-required="true" placeholder="验证码">
                                <span class='text-danger Validform_checktip'></span>
                            </div>
                            <div class="form-group">
                                <button type="submit" class="btn btn-danger" >确定</button>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<!-- 添加银行卡 -->
<div aria-hidden="true" role="dialog" tabindex="-1" id="addCard" class="modal fade">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button aria-hidden="true" data-dismiss="modal" class="close" type="button">×</button>
                <h4 class="modal-title"><?=L('add_card')?></h4>
            </div>
            <div class="modal-body">
                <form role="form" onsubmit="return false;" class='add-card-form' data-action='<?=url('ucenter/add_card')?>'>
                    <div class="form-group">
                        <label for="bank_name"><?=L('bank_name',2)?></label>
                        <select class="form-control" id="bank_name" >
                            <option value="建设银行">CCB-建设银行</option>
                            <option value="农业银行">ABC-农业银行</option>
                            <option value="兴业银行">CIB-兴业银行</option>
                            <option value="民生银行">CMBC-民生银行</option>
                            <option value="浦发银行">SPDB-浦发银行</option>
                            <option value="工商银行">ICBC-工商银行</option>
                            <option value="招商银行">CMB-招商银行</option>
                            <option value="交通银行">BCM-交通银行</option>
                            <option value="广发银行">GDB-广发银行</option>
                            <option value="光大银行">CEB-光大银行</option>
                            <option value="中国银行">BOC-中国银行</option>
                            <option value="邮储银行">PSBC-邮储银行</option>
                            <option value="华夏银行">HB-华夏银行</option>
                        </select>
                    </div>
                    <div class="form-group">
                        <label for="card_num"><?=L('card_num',2)?></label>
                        <input type="text" class="form-control" id="card_num" placeholder="<?=L('card_num',2)?>" data-rule-required="true" data-rule-creditcard='true'>
                    </div>
                    <div class="form-group">
                        <label for="card_name"><?=L('card_name',2)?></label>
                        <input type="text" class="form-control" id="card_name" placeholder="<?=L('card_name',2)?>" data-rule-required="true">
                    </div>
                    <div class="form-group">
                        <label for="card_branch"><?=L('card_branch',2)?></label>
                        <input type="text" class="form-control" id="card_branch" placeholder="<?=L('card_branch',2)?>">
                    </div>
                    <div class="form-group">
                        <label for="remarks"><?=L('remarks',2)?></label>
                        <input type="text" class="form-control" id="remarks" placeholder="<?=L('remarks',2)?>">
                    </div>
                    <button type="submit" class="btn btn-info form-control" ><?=L('submit',2)?></button>
                </form>
            </div>
        </div>
    </div>
</div>
<!-- 提币地址 -->
<div aria-hidden="true" role="dialog" tabindex="-1" id="addOutUrl" class="modal fade">
    <div class="modal-dialog" >
        <div class="modal-content">
            <div class="modal-header">
                <button aria-hidden="true" data-dismiss="modal" class="close" type="button">×</button>
                <h4 class="modal-title"><?=L('out_address',1)?></h4>
            </div>
            <div class="modal-body">
                <form class="form-horizontal out-url-form" role="form" onsubmit="return false;">
                    <div class="form-group">
                        <label for="codeInput" class="col-lg-2 col-sm-2 control-label"><?=L('wallet_address',2)?></label>
                        <div class="col-lg-10">
                            <input type="text" class="form-control" name='info[url]' id="url" data-rule-required="true" placeholder="<?=L('wallet_address',2)?>">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="codeInput" class="col-lg-2 col-sm-2 control-label"><?=L('remarks',2)?></label>
                        <div class="col-lg-10">
                            <input type="text" class="form-control" name='info[remarks]' id="outRemarks" placeholder="<?=L('remarks',2)?>">
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="col-lg-offset-2 col-lg-10">
                            <button type="submit" class="btn btn-danger" ><?=L('submit',2)?></button>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
<!-- 充值 -->
<div aria-hidden="true" role="dialog" tabindex="-1" id="payDialog" class="modal fade">
    <div class="modal-dialog" >
        <div class="modal-content">
            <div class="modal-header">
                <button aria-hidden="true" data-dismiss="modal" class="close" type="button">×</button>
                <h4 class="modal-title"><?=L('pay_address',1)?></h4>
            </div>
            <div class="modal-body">
                <form class="form-horizontal" role="form" onsubmit="return false;">
                    <div class="form-group">
                        <label for="codeInput" class="col-lg-3 control-label"><?=L('pay_address',2)?></label>
                        <div class="col-lg-9">
                            <input type="text" readonly="" class="form-control in_url" value="">
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="col-lg-12">
                            <div class="alert alert-danger" role="alert" style="margin-bottom:0px;"><?=L('pay_notice')?></div>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
<!-- 币种提现 -->
<div aria-hidden="true" role="dialog" tabindex="-1" id="withdrawOutUrl" class="modal fade">
    <div class="modal-dialog" >
        <div class="modal-content">
            <div class="modal-header">
                <button aria-hidden="true" data-dismiss="modal" class="close" type="button">×</button>
                <h4 class="modal-title"><?=L('withdraw_out',1)?></h4>
            </div>
            <div class="modal-body">
                <form class="form-horizontal withdraw-out-form" role="form" onsubmit="return false;">
                    <div class="form-group">
                        <label class="col-sm-2 col-sm-2 control-label"><?=L('coin',2)?></label>
                        <div class="col-sm-10"><p class="form-control-static" id='withdraw-out-coin'></p></div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 col-sm-2 control-label"><?=L('address',2)?></label>
                        <div class="col-sm-10">
                            <select class="form-control" id="address_id"></select>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 col-sm-2 control-label"><?=L('num',2)?></label>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" id='withdraw_num' placeholder="0.00" data-rule-required="true" data-rule-number="true" >
                            <span class='text-danger Validform_checktip'></span>
                            <span class="help-block"><?=L('num',2)?>：<b class="text-success" id='all_money'>0.00</b>，<?=L('fee',2)?>：<b class="text-danger" id='out_fee'>0.00</b>，<?=L('final',2)?>：<b class="text-primary" id='money'>0.00</b></span>
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="col-lg-offset-2 col-lg-10">
                            <button type="submit" class="btn btn-danger" ><?=L('ok',2)?></button>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
<!-- 提币验证 -->
<div aria-hidden="true" role="dialog" tabindex="-1" id="Withdraw_Coin_Auth" class="modal fade">
    <div class="modal-dialog" >
        <div class="modal-content">
            <div class="modal-header">
                <h4 class="modal-title"><?=L('auth',1)?></h4>
            </div>
            <form class="Withdraw_Coin_Auth_Form" role="form" data-action='<?=url('ucenter/out')?>' onsubmit="return false;">
            <div class="modal-body">
                <div class="form-group googleInput">
                    <label><?=L('google_code',2)?></label>
                    <input type="text" class="form-control" name='info[google_code]' id='coinGoogleCodeInput' data-rule-required="true" data-rule-number="6" placeholder="<?=L('google_code',2)?>">
                </div>
                <div class="form-group emailInput" >
                    <label><?=L('email_code',2)?></label>
                    <input type="text" class="form-control" name='info[email_code]' id='coinEmailCodeInput' data-rule-required="true" data-rule-rangelength="[8,8]" placeholder="<?=L('email_code',2)?>">
                </div>
            </div>
            <div class="modal-footer">
                <button type="submit" class="btn btn-danger" ><?=L('ok',2)?></button>
            </div>
            </form>
        </div>
    </div>
</div>
<!-- 添加提币验证 -->
<div aria-hidden="true" role="dialog" tabindex="-1" id="Widthdraw_Address_Auth" class="modal fade">
    <div class="modal-dialog" >
        <div class="modal-content">
            <div class="modal-header">
                <h4 class="modal-title"><?=L('auth',1)?></h4>
            </div>
            <form class="Widthdraw_Address_Auth_Form" role="form" data-action='<?=url('ucenter/out')?>' onsubmit="return false;">
            <div class="modal-body">
                <div class="form-group googleInput">
                    <label><?=L('google_code',2)?></label>
                    <input type="text" class="form-control" name='info[google_code]' id='googleCodeInput' data-rule-required="true" data-rule-number="6" placeholder="<?=L('google_code',2)?>">
                </div>
                <div class="form-group emailInput" >
                    <label><?=L('email_code',2)?></label>
                    <input type="text" class="form-control" name='info[email_code]' id='emailCodeInput' data-rule-required="true" data-rule-rangelength="[8,8]" placeholder="<?=L('email_code',2)?>">
                </div>
            </div>
            <div class="modal-footer">
                <button type="submit" class="btn btn-danger" ><?=L('ok',2)?></button>
            </div>
            </form>
        </div>
    </div>
</div>
<script type="text/html" id='myTradeListTpl'>
    <table class="table table-hover" >
        <thead>
            <tr>
                <th><?=L('trade_time',2)?></th>
                <th><?=L('coin',2)?>/<?=L('trade_coin',2)?></th>
                <th><?=L('type',2)?></th>
                <th width="20%"><?=L('trade_price',2)?></th>
                <th width="20%"><?=L('trade_num',2)?></th>
                <th width="20%"><?=L('total',2)?></th>
            </tr>
        </thead>
        <tbody>
            <%_.each(data.list,function(item){%>
            <tr>
                <td><%= item.addtime %></td>
                <td><%= item.currency %>/<%= item.trade_currency %></td>
                <td><%if(item.type=='sell'){%><span class="text-success"><?=L('_sell',1)?></span><%}else{%><span class="text-danger"><?=L('_buy',1)?></span><%}%></td>
                <td><%if(item.type=='sell'){%><span class="text-success"><%= item.price %></span><%}else{%><span class="text-danger"><%= item.price %></span><%}%></td>
                <td><%= item.num %></td>
                <td><%= formatMoney(accMul(item.num,item.price),8,'','') %></td>
            </tr>
            <%})%>
        </tbody>
    </table>
    <div class="table-foot"><%=data.page%></div>
</script>
<script type="text/html" id='myOrderListTpl'>
    <table class="table table-hover" >
        <thead>
            <tr>
                <th width="13%"><?=L('trade_time',2)?></th>
                <th><?=L('coin',2)?>/<?=L('trade_coin',2)?></th>
                <th width="13%"><?=L('type',2)?></th>
                <th ><?=L('trade_price',2)?></th>
                <th width="13%"><?=L('trade_num',2)?></th>
                <th width="13%"><?=L('trade_overplus',2)?></th>
                <th width="13%"><?=L('trade_total',2)?></th>
                <th><?=L('status',2)?></th>
                <th width="5%"><?=L('action',2)?></th>
            </tr>
        </thead>
        <tbody>
            <%_.each(data.list,function(item){%>
            <tr>
                <td><%= item.addtime %></td>
                <td><%= item.currency %>/<%= item.trade_currency %></td>
                <td><%if(item.type=='sell'){%><span class="text-success"><?=L('_sell',1)?></span><%}else{%><span class="text-danger"><?=L('_buy',1)?></span><%}%></td>
                <td><%if(item.type=='sell'){%><span class="text-success"><%= item.price %></span><%}else{%><span class="text-danger"><%= item.price %></span><%}%></td>
                <td><%= item.num %></td>
                <td><%= formatMoney(accSub(item.num,item.trade_num),8,'','') %></td>
                <td><%= formatMoney(accMul(item.num,item.price),8,'','') %></td>
                <td>
                    <% if(item.status==0){%>
                    <span class="badge bg-light-blue"><?=L('order',2)?></span>
                    <% }else if(item.status==1){%>
                    <span class="badge bg-light-blue"><?=L('trading',2)?></span>
                    <% }else if(item.status==2){%>
                    <span class="badge bg-green"><?=L('traded',2)?></span>
                    <% }else if(item.status==-1){%>
                    <span class="badge bg-red"><?=L('cancel',2)?></span>
                    <%}%>
                </td>
                <td><% if(item.status==0 || item.status==1){%><a href="javascript:;" data-url="<?=url('market/del')?>/orders_id/<%=item.orders_id %>" class="delete"><?=L('cancel',1)?></a><% }else{%>--<%}%></td>
            </tr>
            <%})%>
        </tbody>
    </table>
    <div class="table-foot"><%=data.page%></div>
</script>
<script type="text/html" id='myInListTpl'>
    <table class="table table-hover table-bordered">
        <tr>
            <th><?=L('pay_time',2)?></th>
            <th><?=L('coin',2)?></th>
            <th><?=L('num',2)?></th>
            <th style="width: 40px"><?=L('status',2)?></th>
        </tr>
        <%_.each(data.list,function(item,ind){%>
        <tr>
            <td><%= item.addtime %></td>
            <td><%= item.currency_mark?item.currency_mark:'CNY' %></td>
            <td><%= item.num %></td>
            <td>
                <% if(item.status==0){%>
                <span class="badge bg-yellow"><?=L('confirmation',2)?></span>
                <% }else if(item.status==1){%>
                <span class="badge bg-light-blue"><?=L('checking',2)?></span>
                <% }else if(item.status==2){%>
                <span class="badge bg-red" data-toggle="tooltip" data-original-title="<%= item.remarks %>" ><?=L('fail',2)?></span>
                <% }else if(item.status==3){%>
                <span class="badge bg-info"  data-toggle="tooltip" data-original-title="<%= item.remarks %>"><?=L('processing',2)?></span>
                <% }else if(item.status==4){%>
                <span class="badge bg-olive"  data-toggle="tooltip" data-original-title="<%= item.remarks %>"><?=L('completed',2)?></span>
                <%}%>
            </td>
        </tr>
        <%})%>
    </table>
    <div class="table-foot"><%=data.page%></div>
</script>
<script type="text/html" id='myOutListTpl'>
    <table class="table table-hover table-bordered">
        <tr>
            <th><?=L('withdraw_time',2)?></th>
            <th><?=L('coin',2)?></th>
            <th><?=L('num',2)?></th>
            <th><?=L('fee',2)?></th>
            <th><?=L('final',2)?></th>
            <th style="width: 40px"><?=L('status',2)?></th>
            <th><?=L('action',2)?></th>
        </tr>
        <%_.each(data.list,function(item,ind){%>
        <tr>
            <td><%= item.addtime %></td>
            <td><span data-toggle="tooltip" data-original-title="<?=L('out_address',2)?>：<%= item.url %>"><%= item.currency_mark?item.currency_mark:'CNY' %></span></td>
            <td><%= item.all_num %></td>
            <td><%= item.withdraw_fee %></td>
            <td><%= item.num %></td>
            <td>
                <% if(item.status==0){%>
                <span class="badge bg-yellow"><?=L('confirmation',2)?></span>
                <% }else if(item.status==1){%>
                <span class="badge bg-light-blue"><?=L('checking',2)?></span>
                <% }else if(item.status==2){%>
                <span class="badge bg-red" data-toggle="tooltip" data-original-title="<%= item.remarks %>" ><?=L('fail',2)?></span>
                <% }else if(item.status==3){%>
                <span class="badge bg-info"  data-toggle="tooltip" data-original-title="<%= item.remarks %>"><?=L('processing',2)?></span>
                <% }else if(item.status==4){%>
                <span class="badge bg-olive"  data-toggle="tooltip" data-original-title="<%= item.remarks %>"><?=L('completed',2)?></span>
                <% }else if(item.status==5){%>
                <span class="badge" data-toggle="tooltip" data-original-title="<%= item.remarks %>" ><?=L('cancel',2)?></span>
                <%}%>
            </td>
            <td><% if(item.status==0 || item.status==1){%><a href="javascript:;" data-url="<?=url('cancel_withdraw')?>/withdraw_id/<%=item.withdraw_id %>" class="withdraw_delete"><?=L('cancel',1)?></a><% }else{%>--<%}%></td>
        </tr>
        <%})%>
    </table>
    <div class="table-foot"><%=data.page%></div>
</script>
<script type="text/html" id='myCurrencyListTpl'>
    <table class="table table-hover table-bordered">
        <tr>
            <th><?=L('coin',2)?></th>
            <th><?=L('use',2)?></th>
            <th><?=L('lock',2)?></th>
            <th><?=L('out_address',2)?></th>
            <th><?=L('action',2)?></th>
        </tr>
        <%_.each(data.list,function(item,ind){%>
        <tr>
            <td><%= item.currency_name %>/<%= item.currency_mark %></td>
            <td><%= item.num %></td>
            <td><%= item.forzen_num %></td>
            <td>
                <a href="javascript:;" class="fa fa-plus add_out_url" data-url="<%= item.out_href %>"></a>
            </td>
            <td><a href="javascript:;" class="out_put" data-check-url='<%= item.withdraw_out_check %>' data-url="<%= item.withdraw_out_href %>"><i class="fa fa-minus-circle"></i></a>&nbsp;&nbsp;<a href="javascript:;" class="pay_btn" data-currency='<%= item.currency_mark %>' data-title='<?=L('pay_notice_content')?>' data-url="<%= item.in_href %>"><i class="fa fa-plus-circle"></i></a></td>
        </tr>
        <%})%>
    </table>
    <div class="table-foot"><%=data.page%></div>
</script>
<?php include(__DIR__ . '/../Public/footer.php'); ?>
<script type="text/javascript" >
var is_google_auth = "<?=$member['auth']?1:0?>";
$(function(){
    getCurrencyList($('#myCurrencyList').attr('data-url'));
    getOutList($('#myOutList').attr('data-url'));
    getTradeList($('#myTradeList').attr('data-url'));
    getOrderList($('#myOrderList').attr('data-url'));
    getInList($('#myInList').attr('data-url'));

    function getInList(url,data){
        _.each(data,function(v,k){
            url +='/'+k+'/'+v;
        })
        $.get(url,function(data){
            $('#myInList').html(
                _.template(
                    $('#myInListTpl').html(),
                    {variable: 'data'}
                )(data)
            );
        })
    }
    function getOutList(url,data){
        _.each(data,function(v,k){
            url +='/'+k+'/'+v;
        })
        $.get(url,function(data){
            $('#myOutList').html(
                _.template(
                    $('#myOutListTpl').html(),
                    {variable: 'data'}
                )(data)
            );
            $('[data-toggle="tooltip"]').tooltip();
        })
    }
    function getCurrencyList(url,data){
        _.each(data,function(v,k){
            url +='/'+k+'/'+v;
        })
        $.get(url,function(data){
            $('#myCurrencyList').html(
                _.template(
                    $('#myCurrencyListTpl').html(),
                    {variable: 'data'}
                )(data)
            );
        })
    }
    function getTradeList(url,data){
        _.each(data,function(v,k){
            url +='/'+k+'/'+v;
        })
        $.get(url,function(data){
            $('#myTradeList').html(
                _.template(
                    $('#myTradeListTpl').html(),
                    {variable: 'data'}
                )(data)
            );
        })
    }
    function getOrderList(url,data){
        _.each(data,function(v,k){
            url +='/'+k+'/'+v;
        })
        $.get(url,function(data){
            $('#myOrderList').html(
                _.template(
                    $('#myOrderListTpl').html(),
                    {variable: 'data'}
                )(data)
            );
        })
    }
    //删除委托
    $('#myOrderList').on('click','.delete',function(){
        var me = $(this);
        layer.load(def.dialogStyle);
        $.post(me.attr('data-url'),function(data){
            layer.closeAll('loading');
            if(data.err==0){
                getOrderList($('#myOrderList').attr('data-url'));
            }else{
                err(data.msg);
                getOrderList($('#myOrderList').attr('data-url'));
            }
        });
    });
    //删除提现
    $('#myOutList').on('click','.withdraw_delete',function(){
        var me = $(this);
        layer.load(def.dialogStyle);
        $.post(me.attr('data-url'),function(data){
            layer.closeAll('loading');
            if(data.err==0){
                getOutList($('#myOutList').attr('data-url'));
                getCurrencyList($('#myCurrencyList').attr('data-url'));
            }else{
                err(data.msg);
                getOutList($('#myOutList').attr('data-url'));
                getCurrencyList($('#myCurrencyList').attr('data-url'));
            }
        });
    });
    $('#myInList').on('click','.table-foot a',function(e){
        e.preventDefault();
        getInList($(this).attr('href'));
    });
    $('#myOutList').on('click','.table-foot a',function(e){
        e.preventDefault();
        getOutList($(this).attr('href'));
    });
    $('#myCurrencyList').on('click','.table-foot a',function(e){
        e.preventDefault();
        getCurrencyList($(this).attr('href'));
    });
    $('#myTradeList').on('click','.table-foot a',function(e){
        e.preventDefault();
        getTradeList($(this).attr('href'));
    });
    $('#myOrderList').on('click','.table-foot a',function(e){
        e.preventDefault();
        getOrderList($(this).attr('href'));
    });
    $('#myTradeSearchBtn').on('click',function(){
        var me = $(this);
        var url = $('#myTradeList').attr('data-url');
        var data = {
            'currency_id':me.parent().parent().parent().find('.currency_id').val()
        };
        getTradeList(url,data);
    });
    $('#myOrderSearchBtn').on('click',function(){
        var me = $(this);
        var url = $('#myOrderList').attr('data-url');
        var data = {
            'currency_id':me.parent().parent().parent().find('.currency_id').val()
        };
        getOrderList(url,data);
    });
    $('#myInSearchBtn').on('click',function(){
        var me = $(this);
        var url = $('#myInList').attr('data-url');
        var data = {
            'currency_id':me.parent().parent().parent().find('.currency_id').val()
        };
        getInList(url,data);
    })
    $('#myOutSearchBtn').on('click',function(){
        var me = $(this);
        var url = $('#myOutList').attr('data-url');
        var data = {
            'currency_id':me.parent().parent().parent().find('.currency_id').val()
        };
        getOutList(url,data);
    })
    if(is_google_auth=="0"){
        $('#addAuth').modal({
            backdrop:'static',
            keyboard:false
        });
    }
    $('#addAuthBtn').on('click',function(){
        if(is_google_auth=="0"){
            $('#addAuth').modal();
        }else{
            err('<?=L('bind_google_code')?>');
        }
    })

    $('#myCurrencyList').on('click','.add_out_url',function(){
        var me = $(this);
        $('#addOutUrl').modal();
        def.add_out_url = me.attr('data-url');
        $('#addOutUrl .out-url-form').validate({
            errorElement: "span",
            errorClass  : "text-danger",
            submitHandler: function(form){
                var data = {
                    'info[url]':$('.out-url-form [name="info[url]"]').val(),
                    'info[remarks]':$('.out-url-form [name="info[remarks]"]').val()
                };
                layer.load(def.dialogStyle);
                $.post(def.add_out_url,data,function(data){
                    layer.closeAll('loading');
                    if(data.err==0){
                        $('#addOutUrl').modal('hide');
                    }else if(data.err==2){
                        def.auth_level = data.auth_level;
                        if(def.auth_level==1){
                            $('#Widthdraw_Address_Auth .googleInput').remove();
                        }
                        if(def.auth_level==2){
                            $('#Widthdraw_Address_Auth .emailInput').remove();
                        }
                        $('#Widthdraw_Address_Auth').modal({
                            backdrop:'static',
                            keyboard:false
                        });
                    }else{
                        err(data.msg);
                    }
                })
            }  
        });

        $('.Widthdraw_Address_Auth_Form').validate({
            errorElement: "span",
            errorClass  : "text-danger",
            submitHandler: function(form){
                var _form = $(form);
                var data = {
                    'info[auth_level]':def.auth_level?def.auth_level:0,
                    'info[url]':$('.out-url-form [name="info[url]"]').val(),
                    'info[remarks]':$('.out-url-form [name="info[remarks]"]').val(),
                    'info[google_code]':$("[name='info[google_code]']",_form).val(),
                    'info[email_code]':$("[name='info[email_code]']",_form).val()
                };
                layer.load(def.dialogStyle);
                $.post(def.add_out_url,data,function(data){
                    layer.closeAll('loading');
                    if(data.err==0){
                        success(data.msg,function(){
                            $('#Widthdraw_Address_Auth').modal('hide');
                            $('#addOutUrl').modal('hide');
                            // getCurrencyList($('#myCurrencyList').attr('data-url'));
                        });
                    }else{
                        err(data.msg);
                    }
                });
            }  
        });
    })

    // $('#myCurrencyList').on('click','.add_in_url',function(){
    //     var me = $(this);
    //     $.post(me.attr('data-url'),function(data){
    //         if(data.err==0){
    //             me.parent().html(data.in_url);
    //         }else{
    //             err(data.msg);
    //         }
    //     });
    // })


    $('#myCurrencyList').on('click','.out_put',function(){
        var me = $(this);
        def.withdraw_url = me.attr('data-url');
        layer.load(def.dialogStyle);
        $.post(me.attr('data-check-url'),function(data){
            layer.closeAll('loading');
            if(data.err==0){
                $('#withdrawOutUrl').modal('show');
                $('#withdraw-out-coin').html(data.currency.currency.currency_mark+'（total：'+data.currency.num+'）');

                $('#withdraw_num').on('keyup',function(){
                    var allMoney = $(this).val();
                    if(allMoney<data.currency.num){
                        var out_fee = data.currency.currency.currency_withdraw_fee;
                        // var out_fee = allMoney*(data.currency.currency.currency_withdraw_fee/100);
                        var money = accSub(allMoney,out_fee);
                        $('#all_money').html(formatMoney(allMoney,2,'',''));
                        $('#out_fee').html(formatMoney(out_fee,2,'',''));
                        $('#money').html(formatMoney(money,2,'',''));
                    }
                });
                if(data.address.length>0){
                    var html = '';
                    $('#address_id').html(html);
                    _.each(data.address,function(index,el){
                        html += '<option value="'+index.url+'">'+index.url+'（'+index.remarks+'）</option>';
                    })
                    $('#address_id').html(html);
                }
                $('.withdraw-out-form').validate({
                    errorElement: "span",
                    errorClass  : "text-danger",
                    submitHandler: function(form){
                        var _form = $(form);
                        var data = {
                            'info[withdraw_num]':$("#withdraw_num",_form).val(),
                            'info[url]':$("#address_id",_form).val(),
                        };
                        layer.load(def.dialogStyle);
                        $.post(def.withdraw_url,data,function(data){
                            layer.closeAll('loading');
                            if(data.err==0){
                                success(data.msg,function(){
                                    $('#withdrawOutUrl').modal('hide');
                                    window.location.reload();
                                });
                            }else if(data.err==2){
                                def.auth_level = data.auth_level;
                                if(def.auth_level==1){
                                    $('#Withdraw_Coin_Auth .googleInput').remove();
                                }
                                if(def.auth_level==2){
                                    $('#Withdraw_Coin_Auth .emailInput').remove();
                                }
                                $('#Withdraw_Coin_Auth').modal({
                                    backdrop:'static',
                                    keyboard:false
                                });
                            }else{
                                err(data.msg);
                            }
                        });
                    }  
                });

                $('.Withdraw_Coin_Auth_Form').validate({
                    errorElement: "span",
                    errorClass  : "text-danger",
                    submitHandler: function(form){
                        var _form = $(form);
                        var data = {
                            'info[auth_level]':def.auth_level?def.auth_level:0,
                            'info[withdraw_num]':$(".withdraw-out-form #withdraw_num").val(),
                            'info[url]':$(".withdraw-out-form #address_id").val(),
                            'info[google_code]':$("[name='info[google_code]']",_form).val(),
                            'info[email_code]':$("[name='info[email_code]']",_form).val()
                        };
                        layer.load(def.dialogStyle);
                        $.post(def.withdraw_url,data,function(data){
                            layer.closeAll('loading');
                            if(data.err==0){
                                success(data.msg,function(){
                                    $('#Withdraw_Coin_Auth').modal('hide');
                                    $('#withdrawOutUrl').modal('hide');
                                    // window.location.reload();
                                    getCurrencyList($('#myCurrencyList').attr('data-url'));
                                    getOutList($('#myOutList').attr('data-url'));
                                });
                            }else{
                                err(data.msg);
                            }
                        });
                    }  
                });

            }else{
                err(data.msg);
            }
        });
    })

    $('#myCurrencyList').on('click','.pay_btn',function(){
        var me = $(this);
        var notice = me.attr('data-title');
        notice = notice.replace(/\{1}/g,me.attr('data-currency'));
        layer.alert(notice, {
            title:'<?=L('notice',1)?>',
            closeBtn: 0
        }, function(){
            layer.closeAll();
            layer.load(def.dialogStyle);
            $.post(me.attr('data-url'),function(data){
                layer.closeAll('loading');
                if(data.err==0){
                    $('#payDialog').modal();
                    $('#payDialog .in_url').val(data.in_url);
                }else{
                    err(data.msg);
                }
            });
        });
    })

    $('.hidden-currency').on('ifChecked',function(){
        var me = $(this);
        layer.load(def.dialogStyle);
        $.post(me.attr('data-url'),{'show':'on'},function(data){
            layer.closeAll('loading');
            if(data.err==0){
                getCurrencyList($('#myCurrencyList').attr('data-url'));
            }
        });
    })
    $('.hidden-currency').on('ifUnchecked',function(){
        var me = $(this);
        layer.load(def.dialogStyle);
        $.post(me.attr('data-url'),{'show':'off'},function(data){
            layer.closeAll('loading');
            if(data.err==0){
                getCurrencyList($('#myCurrencyList').attr('data-url'));
            }
        });
    })

})
</script>
</body>
</html>